<template>
    <div style="padding: 8px;">
        <el-card>
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
                <el-form-item label="订单编号">
                    <el-input size="small" v-model="formInline.transactionId" placeholder="订单编号"></el-input>
                </el-form-item>
                <el-form-item label="用户邮箱">
                    <el-input size="small" v-model="formInline.email" placeholder="用户邮箱"></el-input>
                </el-form-item>
                <el-form-item label="用户手机">
                    <el-input size="small" v-model="formInline.phone" placeholder="用户手机"></el-input>
                </el-form-item>
                <!-- <el-form-item :label="$t('创建时间')">
            <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="formInline.createTime" size="small" type="datetime"
              :placeholder="$t('选择日期时间')">
            </el-date-picker>
          </el-form-item> -->
                <el-form-item>
                    <el-button size="small" type="primary" @click="onSubmit">查询</el-button>
                    <el-button size="small" type="primary" @click="reSet">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card v-loading="loading" style="margin-top: 8px;">
            <el-table :data="tableData" style="width: 100%">
                <el-table-column prop="transactionId" label="订单编号">
                </el-table-column>
                <el-table-column prop="phone" label="用户手机">
                </el-table-column>
                <el-table-column prop="email" label="用户邮箱">
                </el-table-column>
                <el-table-column prop="timestamp" label="订单时间">
                </el-table-column>
                <el-table-column prop="remarks" label="备注">
                </el-table-column>
                <el-table-column prop="exchangeCfp" label="消费CFP">
                </el-table-column>
                <el-table-column prop="exchangeRatio" label="兑换时价">
                </el-table-column>
                <el-table-column prop="exchangeUsdt" label="兑换USDT数量">
                </el-table-column>
                <el-table-column prop="usdtBalance" label="兑后USDT结余">
                </el-table-column>
                <el-table-column prop="cfpBalance" label="兑后CFP结余">
                </el-table-column>
            </el-table>
            <el-pagination style="float: right;margin: 5px 0;" @size-change="handleSizeChange"
                @current-change="handleCurrentChange" layout="total, prev, pager, next" :total="total">
            </el-pagination>
        </el-card>
    </div>
</template>
<script>
import { getcfpToUsdtListApi } from '@/api/appuser/usdtTrunCfp'
export default {
    data() {
        return {
            loading: false,
            tableData: [],
            formInline: {
                transactionId: null,
                email: null,
                phone: null,
            },
            total: 0,
            page: {
                pageNum: 1,
                pageSize: 10,
            }
        };
    },
    created() {
        this.getcfpToUsdtList()
    },
    methods: {
        onSubmit() {
            this.page = {
                pageNum: 1,
                pageSize: 10,
            }
            this.getcfpToUsdtList()
        },
        async getcfpToUsdtList() {
            this.loading = true
            const res = await getcfpToUsdtListApi({
                ...this.page,
                ...this.formInline
            })
            console.log(res);
            this.tableData = res.list
            this.total = res.total
            this.loading = false
        },
        reSet() {
            this.page = {
                pageNum: 1,
                pageSize: 10,
            }
            this.formInline = {
                announcementTitle: null,
                createTime: null
            }
            this.getcfpToUsdtList()
        },
        handleSizeChange(val) {
            this.page.pageSize = val;
            this.getcfpToUsdtList();
        },
        handleCurrentChange(val) {
            this.page.pageNum = val;
            this.getcfpToUsdtList();
        },
    },
};
</script>
<style lang='' scoped>
</style>